<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>
    <style>
      .box {
        width: 300px;
        height: 300px;
        /* background-color: red; */
        border: 1px solid #000;
      }
    </style>
  </head>
  <body>
    <div class="box"></div>
    <script>
      const oBox = document.querySelector(".box");

      //鼠标移动事件 的 lodash的使用
      function center(e) {
        console.log("center");
        console.log(e.target);
        console.log(this);
        
      }
      oBox.onmousemove = _.throttle(center, 300);

      /* function enter() {
        this.style.background = "red";
      }

      function leave() {
        this.style.background = "";
      }
      oBox.onmouseenter = _.throttle(enter, 3000, {
        //lodash的节流提供两个配置,leading控制节流返回的回调函数是否在初始的时候触发,trailing控制节流返回的回调函数是否在最后也触发
        leading: true,
        trailing: false,
      });
      oBox.onmouseleave = leave; */
    </script>
  </body>
</html>
